from my1 import views as my1_views  # 使用别名避免冲突
from chat import views as chat_views
from django.http import HttpResponse
from my1 import views as views

def ping_view(request):
    return HttpResponse("pong")

from django.urls import path, include
from my1.views import RegisterView, LoginView

urlpatterns = [
    path('register/', RegisterView.as_view(), name='register'),
    path('login/', LoginView.as_view(), name='login'),
    path('products/', my1_views.product_list, name='product-list'),  # 使用my1_views引用
    path('operations/', my1_views.inventory_operation, name='inventory-operation'),  # 使用my1_views引用
    path('api/ping/', my1_views.ping, name='my1_ping'),
    path('verify_invite_code/', my1_views.verify_invite_code, name='verify-invite-code'),  # 使用my1_views引用
    path('save_invite_code/', my1_views.save_invite_code, name='save-invite-code'),  # 使用my1_views引用
    path('qkd/', include('qkd_app.urls')),
    path('api/login/', chat_views.login, name='login'),  # 使用chat_views引用
    path('ping/', ping_view, name='ping'),  # 这里有重复的路由，需要解决
    path('api/normal-orders/', my1_views.normal_orders, name='normal-orders'),
    path('api/private-orders/', my1_views.private_orders, name='private-orders'),
    # 处理登录请求的 POST 请求
    path('login1/', views.login_view, name='login'),  # 这里是登录页面的路径
    path('index/', views.index_view, name='index'),  # 登录成功后的跳转页面
    path('user/', views.user_view, name='user'),
    path('shop/', views.shop_view, name='shop'),
    path('products/<str:product_code>/', my1_views.delete_product, name='delete-product'),
    path('api/user-info/', views.user_info, name='user-info'),
    path('create-operation/', my1_views.create_operation_record, name='create-operation'),
    path('api/check-qkd/', my1_views.check_qkd_available, name='check-qkd-available'),
    path('chat/', my1_views.chat_view, name='chat'),  # 使用chat_views引用ai
    path('api/check-first-user/', views.check_is_first_user, name='check-is-first-user'),
]